﻿#pragma once
struct _stStrategyTerrainD3DVertex
{
	float x, y;			// 位置
	float height;		// 高度
};

class CStrategyTerrainRender
{
private:
	LPDIRECT3DVERTEXBUFFER9			m_pVBTerrainSquare;	// 顶点缓冲区指针
	LPDIRECT3DINDEXBUFFER9			m_pIBTerrainSquare;	// 索引缓冲区指针
	DWORD							m_dwTerrainSquareVerticesNum;	// 顶点个数
	DWORD							m_dwTerrainSquareIndicesNum;	// 索引个数
	 
	LPDIRECT3DVERTEXDECLARATION9	m_pDecl;	// 顶点声明接口
	LPD3DXEFFECT					m_pEffect;	// 效果接口

public:
	CStrategyTerrainRender();
	~CStrategyTerrainRender();

public:
	HRESULT		OnCreateDevice(IDirect3DDevice9* pd3dDevice);
	HRESULT		OnResetDevice(IDirect3DDevice9* pd3dDevice);
	void		OnFrameMove(const D3DXMATRIXA16* pWorldViewProject);
	void		OnFrameRender(IDirect3DDevice9* pd3dDevice);
	void		OnLostDevice();
	void		OnDestroyDevice();

private:
	HRESULT CreateMeshWhenResetDevice(IDirect3DDevice9* pd3dDevice);	// 创建模型
};